<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>图结构</title>
	</head>
	<body>
		<script src="index.js"></script>
		<script>
			let craph = new Graph()
			let str = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I']
			str.forEach((item) => {
				craph.addVertex(item)
			})
			craph.addEdge('A', 'B')
			craph.addEdge('A', 'C')
			craph.addEdge('A', 'D')
			craph.addEdge('C', 'D')
			craph.addEdge('C', 'G')
			craph.addEdge('D', 'G')
			craph.addEdge('D', 'H')
			craph.addEdge('B', 'E')
			craph.addEdge('B', 'F')
			craph.addEdge('E', 'I')
			// console.log(craph)
			console.log(craph.toString())
			let res = ''
			// craph.bfs(craph.vertex[0], function hadel(v) {
			// 	res += v + ' '
			// })
			craph.dfs(craph.vertex[0], function hadel(v) {
				res += v + ' '
			})
			console.log(res)
		</script>
	</body>
</html>
